package com.cloudfun.campusshare.configuration.jpa.util;

import org.apache.commons.beanutils.converters.DateConverter;

import java.util.Date;

/**
 * @author 王溪源
 * @ClassName: ConvertUtils
 * @Description: TODO
 * @Date 2020/8/10 14:24
 **/
public class ConvertUtils extends org.apache.commons.beanutils.ConvertUtils {
    static {
        registerDateConverter ("yyyy-MM-DD", "yyyy-MM-DD HH:mm:ss");
    }

    public static void registerDateConverter(String... patterns) {
        DateConverter dateConverter = new DateConverter ();
        dateConverter.setUseLocaleFormat (true);
        dateConverter.setPatterns (patterns);
        register (dateConverter, Date.class);
    }
}
